package com.fdb.efp.nls.common.constant.sed;

import java.util.stream.Stream;
/**
 * 需求编号:2019D0519
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/7/17
 * 功能描述:税e贷插槽配置
 * 修改日期:2019/7/17
 * 修改描述:
 */
public enum SEDAdaptedSoltEnum {
    SOLT_WHITELIST_AC_RULE("11110001", "whiteListAcRule", "白名单准入规则服务", "whiteListAcRuleService", "1", 1),
    SOLT_LOCAL_AC_RULE("11110001", "localAccessRule", "本地准入规则服务", "localAccessRuleService", "1", 2),
    SOLT_CREDIT_PBOC("11110001", "personalLoanWhetherExist", "查询个贷准入规则服务", "personalLoanWhetherExistService", "1", 3),
    SOLT_TAX_ACCESS_RULE("11110001", "taxBureauAccessRule", "税局准入规则校验服务", "taxBureauAccessRuleService", "1", 4),
    SOLT_BLACK_AC_RULE("11110001", "blackListAcRule", "黑名单准入规则服务", "blackListAcRuleService", "1", 5),
    SOLT_GENERATION_CREDIT_RULE("11110001", "generationCreditRule", "征信规则服务", "generationCreditRuleService", "1", 6),
    SOLT_WHIELD_RISK_RULE("11110001", "whieldRiskRule", "同盾规则服务", "whieldRiskRuleService", "1", 7),
    SOLT_XX_APR_CALL("11110001", "lmtEstimate", "额度测算服务", "lmtEstimateService", "1", 8),
    SOLT_CUS_DOCUMENTATION("11110001", "cusDocumentation", "客户建档服务", "cusDocumentationService", "1", 9),
    SOLT_GENERATE_LIMIT("11110001", "generateLimit", "生成额度信息服务", "generateLimitService", "1", 10),
    SOLT_CTR_SIGN_RULE("11110001", "ctrSignExeJudge", "合同签订规则服务", "ctrSignExeJudgeService", "1", 11),
    SOLT_CTR_UPD_RULE("11110001", "ctrSignDataCrd", "合同签订更新数据服务", "ctrSignDataCrdService", "1", 12),
    SOLT_CTR_LMT_EFF_RULE("11110001", "ctrSignUpdLmtEffect", "合同签订更新额度服务", "ctrSignUpdLmtEffectService", "1", 13),

    /** 支用插槽配置------------------------------------------- start */
    SOLT_USE_LETTER_RULE("11110001", "useLetterAcRule", "用信申请本地准入服务", "useLetterAcRuleService", "2", 1),
	SOLT_USE_LETTER_PBOC("11110001", "personalLoanWhetherApplyExist", "查询个贷准入规则服务", "personalLoanWhetherApplyExistService", "2", 2),
	SOLT_GENERATION_APPLY_RULE("11110001", "applyZXCreditRule", "人行征信规则服务", "applyZXCreditRuleService", "2", 3),
	SOLT_REPAY("11110001", "applyLoanRelease", "放款服务", "applyLoanReleaseService", "2", 4),
	SOLT_SYNC_LOANINFO("11110001", "synLoanInfo", "借据还款计划同步服务", "synLoanInfoService", "2", 5),
    /** 支用插槽配置------------------------------------------- end */


	/************* 还款插槽配置  ------------------------ start */
	SOLT_REPAY_AC_RULE("11110001", "repayApplJudge", "还款申请准入服务", "repayApplJudgeService", "4", 1),
	SOLT_REPAY_AFTER_SYN("11110001", "synInfoAfterRepay", "借据信息、还款计划信息更新插槽服务", "synInfoAfterRepayService", "4", 2);
	

    // 产品ID
    private String prdId;
    // 插槽代码
    private String soltCode;
    // 插槽名称
    private String soltName;
    // 插槽服务类
    private String soltService;
    // 插槽阶段类
    private String soltStage;
    // 插槽顺序
    private int soltOrder;

    public String getPrdId() {
        return prdId;
    }

    public String getSoltCode() {
        return soltCode;
    }

    public String getSoltName() {
        return soltName;
    }

    public String getSoltService() {
        return soltService;
    }

    public String getSoltStage() {
        return soltStage;
    }

    public int getSoltOrder() {
        return soltOrder;
    }

    private SEDAdaptedSoltEnum(String prdId, String soltCode, String soltName, String soltService, String soltStage, int soltOrder) {
        this.prdId = prdId;
        this.soltCode = soltCode;
        this.soltName = soltName;
        this.soltService = soltService;
        this.soltStage = soltStage;
        this.soltOrder = soltOrder;
    }

    public static SEDAdaptedSoltEnum parse(String prdId, String soltCode) {
        return Stream.of(SEDAdaptedSoltEnum.values()).filter(value -> value.prdId.equals(prdId) && value.soltCode.equals(soltCode))
                .findFirst().orElseThrow(RuntimeException::new);

    }

    public boolean validateSoltService(String soltName, String soltService, String soltStage, int soltOrder) {
        return this.soltName.equals(soltName) && this.soltService.equals(soltService) && this.soltStage.equals(soltStage) && this.soltOrder == soltOrder;
    }
}
